//
//  SuperViewController.m
//  Doctor1.0
//
//  Created by mk on 15/11/3.
//  Copyright (c) 2015年 cocoa-mk. All rights reserved.
//

#import "SuperViewController.h"

@interface SuperViewController ()
{
    NSString *strChirdContrllerClassNameForUM;
   
}


@end

@implementation SuperViewController


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        strChirdContrllerClassNameForUM = nibNameOrNil;
        self.hidesBottomBarWhenPushed = YES;
        self.title = @"";
    }
    return self;
}

-(void)tabbarDidChangedToSelectedViewController
{
    DLog(@"slelct");
}

-(void)refreshTableListDataWithRequest:(BOOL)needRequest
{
    DLog(@"refresh");
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    [self.navigationController setNavigationBarHidden:NO animated:YES];
    
    if (NSVersionNumber_iOS_7_0) {
        [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    }
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [[BaiduMobStat defaultStat] pageviewStartWithName:strChirdContrllerClassNameForUM];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
    
    [[BaiduMobStat defaultStat] pageviewEndWithName:strChirdContrllerClassNameForUM];
}


- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the 0view from its nib.
    
    if (NSVersionNumber_iOS_7_0)
    {
        self.edgesForExtendedLayout = UIRectEdgeNone;
        viewNavBg = [[UIImageView alloc] initWithFrame:CGRectMake(0, -64, appScreenWidth, 64)];
        viewNavBg.image = nil;
        viewNavBg.backgroundColor = defaultNavBackColor;
        [self.view addSubview:viewNavBg];
    }
    //26B1A4
    self.navigationItem.hidesBackButton = YES;
    self.view.backgroundColor = [UIColor whiteColor];
    
    //返回按钮
    btnBack = [UIButton buttonWithType:UIButtonTypeCustom];
    btnBack.frame = CGRectMake(0, 0, 40, 40);
    [btnBack addTarget:self action:@selector(backNav:) forControlEvents:UIControlEventTouchUpInside];
    btnBack.backgroundColor = [UIColor clearColor];
    btnBack.titleLabel.textAlignment = NSTextAlignmentLeft;
    [btnBack setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [btnBack setTitleColor:[UIColor colorWithWhite:1.0 alpha:0.6] forState:UIControlStateHighlighted];
    [btnBack setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
    UIBarButtonItem *btnLeftItem = [[UIBarButtonItem alloc] initWithCustomView:btnBack];
    self.navigationItem.leftBarButtonItem = btnLeftItem;
    SetBtnImages(btnBack, @"left_back_white_icon.png", nil);
    
    //更多按钮
    btnMore = [UIButton buttonWithType:UIButtonTypeCustom];
    btnMore.frame = CGRectMake(0, 0, 80, 40);
    [btnMore addTarget:self action:@selector(rightBarAction:) forControlEvents:UIControlEventTouchUpInside];
    btnMore.backgroundColor = [UIColor clearColor];
    btnMore.titleLabel.font = [UIFont systemFontOfSize:15];
    [btnMore setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [btnMore setTitleColor:[UIColor colorWithWhite:1.0 alpha:0.6] forState:UIControlStateHighlighted];
    [btnMore setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
    UIBarButtonItem *btnRightItem = [[UIBarButtonItem alloc] initWithCustomView:btnMore];
    self.navigationItem.rightBarButtonItem = btnRightItem;
    
    
    titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 180, 30)];
    titleLabel.font = [UIFont fontWithName:@"STHeitiSC-Medium" size:18];
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.textColor = [UIColor colorWithWhite:1.0 alpha:1.0];
    [self.navigationItem setTitleView:titleLabel];
    
}


-(void)backNav:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)rightBarAction:(id)sender
{
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (BOOL)shouldAutorotate

{
    return NO;
    
}


//- (void)didReceiveMemoryWarning {
//    [super didReceiveMemoryWarning];
//    // Dispose of any resources that can be recreated.
//}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
